<?php /* Smarty version 2.6.18, created on 2015-10-17 11:47:33
         compiled from addServerList.html */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "top.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "left.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="javascript:void(0);">游戏管理</a>
							</li>
							<li class="active"><a href="javascript:void(0);">添加游戏</a></li>
						</ul><!-- .breadcrumb -->
					</div>

					<div class="page-content">

						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->
								
								<div class="row">
									<div class="col-sm-12">
										<div class="widget-box">
											<div class="widget-header header-color-blue2">
												<h4 class="lighter smaller"></h4>
											</div>

											<div class="widget-body">
												<div class="widget-main ">

													<form class="form-horizontal" role="form">
														<br/>
														
														<div class="form-group">
															<label class="col-sm-5 control-label no-padding-right" for="form-field-5">游戏名称:</label>
															<div class="col-sm-6">
																<div class="clearfix">
																	<div class="col-sm-3">
																	<select id="selectGame">
																		<option value="" >游戏</option>
																		<?php if ($this->_tpl_vars['selectGames']): ?> <?php $_from = $this->_tpl_vars['selectGames']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
																		<?php if ($this->_tpl_vars['nowGame'] == $this->_tpl_vars['value']): ?>
																		<option value="<?php echo $this->_tpl_vars['value']; ?>
" selected><?php echo $this->_tpl_vars['value']; ?>
</option>
																		<?php else: ?>
																		<option value="<?php echo $this->_tpl_vars['value']; ?>
"><?php echo $this->_tpl_vars['value']; ?>
</option>
																		<?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?>
																	</select>
																		</div>
																</div>
																<div class="help-block" id="inputGameName"></div>
															</div>
														</div>
														<div class="form-group">
															<label class="col-sm-5 control-label no-padding-right" for="form-field-5">游戏平台:</label>
															<div class="col-sm-6">
																<div class="clearfix">
																	<div class="col-sm-3">
																	<select id="platform">
																<option value="" >平台</option>
																	<?php if ($this->_tpl_vars['platforms']): ?> <?php $_from = $this->_tpl_vars['platforms']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
																	<?php if ($this->_tpl_vars['platform'] == $this->_tpl_vars['value']): ?>
																	<option value="<?php echo $this->_tpl_vars['value']; ?>
" selected><?php echo $this->_tpl_vars['value']; ?>
</option>
																	<?php else: ?>
																	<option value="<?php echo $this->_tpl_vars['value']; ?>
"><?php echo $this->_tpl_vars['value']; ?>
</option>
																	<?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?>
																</select>
																		</div>
																</div>
																<div class="help-block" id="inputGameName"></div>
															</div>
														</div>
														
														<div class="form-group">
															<label class="col-sm-5 control-label no-padding-right" for="form-field-5">serverList名称:</label>

															<div class="col-sm-6">
																<div class="clearfix">
																	<input class="col-xs-3" type="text" id="serverListName" value="serverList.cfg" placeholder="serverList.cfg" />
																</div>

																<div class="help-block" id="inputGameName"></div>
															</div>
														</div>
														<div class="form-group">
															<label class="col-sm-5 control-label no-padding-right" for="form-field-5">ftp地址:</label>

															<div class="col-sm-6">
																<div class="clearfix">
																	<input class="col-xs-3" type="text" id="ftpAddress" placeholder="" />
																</div>


																<div class="help-block" id="inputLogUserName"></div>
															</div>
														</div>
														<div class="form-group">
															<label class="col-sm-5 control-label no-padding-right" for="form-field-5">ftp用户名:</label>

															<div class="col-sm-6">
																<div class="clearfix">
																	<input class="col-xs-3" type="text" id="ftpUser" placeholder="" />
																</div>

																<div class="help-block" id="inputLogUserPwd"></div>
															</div>
														</div>
														
														<div class="form-group">
															<label class="col-sm-5 control-label no-padding-right" for="form-field-5">ftp密码:</label>

															<div class="col-sm-6">
																<div class="clearfix">
																	<input class="col-xs-3" type="text" id="ftpPwd" placeholder="" />
																</div>

																<div class="help-block" id="inputLogPath"></div>
															</div>
														</div>
													</form>

													<h3 class="header smaller lighter green"></h3>
													<div class="clearfix">
														<center>
															<button type="button" onClick="formSubmit();" class="btn btn-info btn-success">
																<!--<i class="icon-bolt"></i>-->
																添加
															</button>
														</center>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
								
								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div><!-- /.main-content -->
		<script type="text/javascript">

			jQuery(function($) {
	/*			inputSlider($('#inputGameName'), $('#game'));
				inputSlider($('#inputGamePlatform'), $('#platform'));
				inputSlider($('#inputGameChannel'), $('#channel'));
				inputSlider($('#inputLogUserName'), $('#logUserName'));
				inputSlider($('#inputLogUserPwd'), $('#logUserPwd'));
				inputSlider($('#inputLogPath'), $('#logPath'));
				inputSlider($('#inputSshPort'), $('#sshPort'));
	*/	
			});

			function inputSlider(inputNode, sliderNode) {
				inputNode.slider({
					value:3,
					range: "min",
					min: 3,
					max: 12,
					step: 1,
					slide: function( event, ui ) {
						var val = parseInt(ui.value);
						sliderNode.attr('class', 'col-xs-'+val);
					}
				});
			}

			function formSubmit() {
				var param = {};
				param['mod'] = 'ServerList';
				param['do'] = 'addServerList';
				
				param['action'] = 1;
				param['game'] = $('#selectGame').val();
				param['platform'] = $('#platform').val();
				param['serverListName'] = $('#serverListName').val();
				param['ftpAddress'] = $('#ftpAddress').val();
				param['ftpUser'] = $('#ftpUser').val();
				param['ftpPwd'] = $('#ftpPwd').val();
				
				if (!param['game']) {
					alert("请选择游戏");
				} else if (!param['platform']) {
					alert("请选择平台");
				} else if (!param['serverListName']) {
					alert("请输入serverListName");
				}	else {
					$.ajax({
						type:'POST',
						url:'index.php',
						data:param,
						dataType:'html',
						success:function(data) {
							var dataObj = eval("(" + data + ")");//转换为json对象
							if(dataObj.code == 1) {
								alert(dataObj.msg);
								window.location.href = "index.php?mod=ServerList&do=configure"+"&game="+param['game']+"&platform="+param['platform']+"&action=1&type=select";
							} else {
								alert(dataObj.msg);
							}
						}
					});
				}
			}
			
			window.onload = function(){
				// pc设备
			    var select = document.getElementById('selectGame');
			    select.onchange = function(){
			    	
			        // 更改值后执行的代码
			       var gameName = jQuery("#selectGame  option:selected").text();
			       var _tagNum = 1;
			       $.ajax({
			    	    type: "POST",
						url: "index.php?mod=Game&do=getPlatformByGame&game=" + gameName,
						data: "",
						dataType: 'html',
						success: function(data) {					
							var dataObj = eval("(" + data + ")");//转换为json对象
							
							if(dataObj == null) {
								$("#platform").empty();
								$("#platform").append('<option value="" id="selectPlatform">平台</option>');
							}
							
							var platform = dataObj.platform;
							$("#platform").empty();
							$("#platform").append('<option value="" id="selectPlatform">平台</option>');
							for(var i=0;i<platform.length;i++){
								$("#platform").append("<option value='"+platform[i]+"' >"+platform[i]+"</option>"+"<br/>");
							}
						}
			       });
			    }
			}
			
		</script>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "footer.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
